<template>
  <div class="daiying">
    <div class="nice">
      <span class="title">最受好评的电影</span>
      <div class="hot">
        <div v-for="(item, key) in coming" class="hotMovie" :key="key">
          <img :src="item.img" alt="" />
          <span class="movie-nm">{{ item.nm }}</span>
          <span class="showTime">{{ item.comingTitle }}</span>
        </div>
      </div>
    </div>
    <div class="bottom">
      <div class="list" v-for="(item, index) in coming" :key="index">
        <p class="title">{{ item.comingTitle }}</p>
        <div class="list-block">
          <div class="list-imgBlock">
            <img
              class="list-img"
              :src="item.img"
              width="64"
              height="90"
              alt=""
            />
          </div>
          <div class="list-msg">
            <div class="list-msg-left">
              <p>{{ item.nm }}</p>
              <p v-if="item.globalReleased && item.sc !== 0">
                观众评
                <span class="score">{{ item.mk }}</span>
              </p>
              <p v-else-if="item.globalReleased">{{ item.scoreLabel }}</p>
              <p v-else>
                <span class="score">{{ item.wish }}</span
                >人想看
              </p>
              <p>{{ item.star }}</p>
              <p>{{ item.rt }}上映</p>
            </div>
            <div class="list-msg-right">
              <button
                v-if="item.showStateButton != null"
                class="list-buy"
                :style="{ 'background-color': item.showStateButton.color }"
              >
                {{ item.showStateButton.content }}
              </button>
              <button v-else class="list-buy">想看</button>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "wait",
  data() {
    return {
      coming: [],
    };
  },
  created() {
    this.$axios
      .get("/daiying/ajax/comingList?ci=10&token=&limit=10")
      .then((data) => {
        this.coming = data.data.coming.map((item) => {
          item.img = item.img.replace("w.h", "128.180"); //64*90
          return item;
        });
      });
  },
};
</script>

<style scoped>
.nice {
  padding: 0.266667rem 0.4rem;
  background-color: #fff;
  margin-bottom: 0.4rem;
  padding-bottom: .533333rem;
}

.title {
  font-size: 0.373rem;
}

.hotMovie {
  display: flex;
  flex-direction: column;
  margin-right: 0.213rem;
  flex: 1 1 auto;
}

.hotMovie img {
  width: 2.267rem;
  height: 3.067rem;
  flex: 0 0 auto;
}

.movie-nm {
  width: 2.267rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: bold;
  font-size: 0.385rem;
  margin-top: 0.133rem;
}

.hot {
  display: flex;
  overflow: auto;
  padding-top: 0.4rem;
}

.daiying {
  width: 100%;
  background-color: #f5f5f5;
}
.daiying .bottom {
  margin-top: 10px;
}
.daiying .bottom .list {
  width: 100%;
  height: 3.92rem;
  background-color: #fff;
  padding: 12px 15px 12px 15px;
}
.daiying .bottom .list .title {
  margin-bottom: 12px;
  font-size: 14px;
  color: #333;
}

.daiying .bottom .list .list-block {
  display: flex;
}

.list .list-imgBlock {
  width: 1.8rem;
  min-width: 1.8rem;
  margin-right: 10px;
}

.list .list-imgBlock .list-img {
  width: 100%;
  object-fit: contain;
}

.list .list-msg {
  flex: 1;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
}

.list .list-block .list-msg-left {
  flex: 1;
  overflow: hidden;
  max-width: 6rem;
}

.list .list-block .list-msg-left .score {
  font-weight: 700;
  color: #faaf00;
  font-size: 0.4rem;
}

.list .list-block .list-msg-left p {
  margin-bottom: 5px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.list .list-block .list-msg-left p:nth-of-type(1) {
  font-size: 17px;
  color: #333;
  font-weight: 700;
}

.list .list-block .list-msg-left p:nth-of-type(2),
.list .list-block .list-msg-left p:nth-of-type(3),
.list .list-block .list-msg-left p:nth-of-type(4) {
  font-size: 13px;
  color: #666;
}

.list .list-block .list-msg-right {
  display: flex;
  min-width: 50px;
}

.list .list-block .list-msg-right .list-buy {
  margin: auto;
  width: 1.44rem;
  height: 0.747rem;
  color: #fff;
  white-space: nowrap;
  font-size: 0.26rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 0.5rem;
  border: 0;
  background-color: #faaf00;
}
</style>
